package com.wangxin.study8.threadtest;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/**
 * @author jojo.wang
 * @title: CallableTest
 * @projectName study8
 * @description: Callable
 * @date 2019/5/618:10
 */

public class CallableTest implements Callable<Integer> {
    @Override
    public Integer call() throws Exception {
        return 12;
    }

    public static void main(String[] args) throws Exception{
        CallableTest callableTest = new CallableTest();
        FutureTask<Integer> task = new FutureTask<>(callableTest);
        Thread thread = new Thread(task);
        thread.start();
        System.out.println(task.get());
    }
}
